1
|
|
|
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
2
|
|
|
// |
3
|
|
|
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
4
|
|
|
// |
5
|
|
|
// This program is free software; you can redistribute it and/or modify it under the |
6
|
|
|
// terms of the GNU Lesser General Public License as published by the Free Software |
7
|
|
|
// Foundation; either version 3.0 of the License, or (at your option) any later |
8
|
|
|
// version. |
9
|
|
|
// |
10
|
|
|
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
11
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
12
|
|
|
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
13
|
|
|
// |
14
|
|
|
// You should have received a copy of the GNU Lesser General Public License along |
15
|
|
|
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
16
|
|
|
|
17
|
|
|
// Room specific js for copy button and email link. |
18
|
|
|
$(document).on('turbolinks:load', function(){ |
19
|
|
|
var controller = $("body").data('controller'); |
20
|
|
|
var action = $("body").data('action'); |
21
|
|
|
|
22
|
|
|
// Only run on room pages. |
23
|
|
|
if (controller == "rooms" && action == "show"){ |
24
|
|
|
var copy = $('#copy'); |
25
|
|
|
|
26
|
|
|
// Handle copy button. |
27
|
|
|
copy.on('click', function(){ |
28
|
|
|
var inviteURL = $('#invite-url'); |
29
|
|
|
inviteURL.select(); |
30
|
|
|
|
31
|
|
|
var success = document.execCommand("copy"); |
32
|
|
|
if (success) { |
33
|
|
|
inviteURL.blur(); |
34
|
|
|
copy.addClass('btn-success'); |
35
|
|
|
copy.html("<i class='fas fa-check'></i> Copy") |
36
|
|
|
setTimeout(function(){ |
37
|
|
|
copy.removeClass('btn-success'); |
38
|
|
|
copy.html("<i class='fas fa-copy'></i> Copy") |
39
|
|
|
}, 2000) |
40
|
|
|
} |
41
|
|
|
}); |
42
|
|
|
|
43
|
|
|
// Handle recording emails. |
44
|
|
|
$('.email-link').each(function(){ |
45
|
|
|
$(this).click(function(){ |
46
|
|
|
var subject = $(".username").text() + " " + t('room.mailer.subject'); |
47
|
|
|
var body = t('room.mailer.body') + "\n\n" + $(this).attr("data-pres-link"); |
48
|
|
|
var autogenerated = "\n\n" + t('room.mailer.autogenerated') + "\n"; |
49
|
|
|
var footer = t('room.mailer.footer'); |
50
|
|
|
|
51
|
|
|
var url = "mailto:?subject=" + encodeURIComponent(subject) + "&body=" + encodeURIComponent(body) + encodeURIComponent(autogenerated) + encodeURIComponent(footer); |
52
|
|
|
var win = window.open(url, '_blank'); |
53
|
|
|
|
54
|
|
|
win.focus(); |
55
|
|
|
}); |
56
|
|
|
}); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
// Display and update all fields related to creating a room in the createRoomModal |
60
|
|
|
$("#create-room-block").click(function(){ |
61
|
|
|
$("#create-room-name").val("") |
62
|
|
|
$("#createRoomModal form").attr("action", $("body").data('relative-root')) |
63
|
|
|
updateDropdown($(".dropdown-item[value='default']")) |
64
|
|
|
$("#room_mute_on_join").prop("checked", false) |
65
|
|
|
|
66
|
|
|
//show all elements & their children with a create-only class |
67
|
|
|
$(".create-only").each(function() { |
68
|
|
|
$(this).show() |
69
|
|
|
if($(this).children().length > 0) { $(this).children().show() } |
70
|
|
|
}) |
71
|
|
|
|
72
|
|
|
//hide all elements & their children with a update-only class |
73
|
|
|
$(".update-only").each(function() { |
74
|
|
|
$(this).attr('style',"display:none !important") |
75
|
|
|
if($(this).children().length > 0) { $(this).children().attr('style',"display:none !important") } |
76
|
|
|
}) |
77
|
|
|
}) |
78
|
|
|
|
79
|
|
|
// Display and update all fields related to creating a room in the createRoomModal |
80
|
|
|
$(".update-room").click(function(){ |
81
|
|
|
var room_block_uid = $(this).closest("#room-block").data("room-uid") |
82
|
|
|
$("#create-room-name").val($(this).closest("tbody").find("#room-name h4").text()) |
83
|
|
|
$("#createRoomModal form").attr("action", room_block_uid + "/update_settings") |
84
|
|
|
|
85
|
|
|
//show all elements & their children with a update-only class |
86
|
|
|
$(".update-only").each(function() { |
87
|
|
|
$(this).show() |
88
|
|
|
if($(this).children().length > 0) { $(this).children().show() } |
89
|
|
|
}) |
90
|
|
|
|
91
|
|
|
//hide all elements & their children with a create-only class |
92
|
|
|
$(".create-only").each(function() { |
93
|
|
|
$(this).attr('style',"display:none !important") |
94
|
|
|
if($(this).children().length > 0) { $(this).children().attr('style',"display:none !important") } |
95
|
|
|
}) |
96
|
|
|
|
97
|
|
|
updateCurrentSettings($(this).closest("#room-block").data("room-settings")) |
98
|
|
|
}) |
99
|
|
|
|
100
|
|
|
//Update the createRoomModal to show the correct current settings |
101
|
|
|
function updateCurrentSettings(settings){ |
102
|
|
|
//set checkbox |
103
|
|
|
if(settings.muteOnStart){ |
104
|
|
|
$("#room_mute_on_join").prop("checked", true) |
105
|
|
|
} else { //default option |
106
|
|
|
$("#room_mute_on_join").prop("checked", false) |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
//set dropdown value |
110
|
|
|
if (settings.joinViaHtml5) { |
111
|
|
|
updateDropdown($(".dropdown-item[value='html5']")) |
112
|
|
|
} else if (settings.joinViaHtml5 === false) { |
113
|
|
|
updateDropdown($(".dropdown-item[value='flash']")) |
114
|
|
|
} else { //default option |
115
|
|
|
updateDropdown($(".dropdown-item[value='default']")) |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
}); |
119
|
|
|
|
120
|
|
|
// Updates the dropdown element to show the clicked/correct text |
121
|
|
|
function updateDropdown(element) { |
122
|
|
|
$("#dropdown-trigger").text(element.text()) |
123
|
|
|
$("#room_client").val(element.val()) |
124
|
|
|
} |
125
|
|
|
|